/**
 * 生成缓存模块，关闭浏览器时销毁对应的数据
 * @type {Storage}
 */
const session = window.sessionStorage
const sessionStorage = {
  setSessionStorage: function (key, value) {
    session.setItem(key, JSON.stringify(value))
  },
  getSessionStorage: function (key) {
    return JSON.parse(session.getItem(key))
  },
  removeSessionStorage: function (key) {
    session.removeItem(key)
  },
  clearSessionStorage: function () {
    session.clear()
  }
}
export default sessionStorage
